David Alberto Montaño Fetecua
The essence of abstractions is preserving information that is relevant in a given context, and forgetting information that is irrelevant in that context.
– John V. Guttag
$ gcloud config set compute/zone us-west1-a
$ gcloud container clusters create s4n-cluster
$ gcloud auth application-default login
$ az group create --name=s4n --location=westus
$ az aks create --resource-group=s4n --name=s4n-cluster
$ az aks get-credentials --resource-group=s4n --name=s4n-cluster
$ eksctl create cluster --name s4n ...
$ doctl kubernetes cluster list
$ doctl kubernetes cluster kubeconfig save s4n
Asegúrese de instalar un hypervisor como virtualbox o kvm.
$ minikube start
$ minikube stop
$ minikube delete
Kubernetes in Docker
$ kind create cluster --wait 5min
$ export KUBECONFIG="$(kind get kubeconfig-path)"
$ kubectl cluster-info
$ kind delete cluster
# On Server
$ curl -sfL https://get.k3s.io | sh -
$ sudo k3s server &
# Kubeconfig is written to /etc/rancher/k3s/k3s.yaml
$ sudo k3s kubectl get nodes
# On Nodes
$ curl -sfL https://get.k3s.io | K3S_URL=https://myserver:6443 K3S_TOKEN=XXX sh -
# On a different node run the below. NODE_TOKEN comes from
# /var/lib/rancher/k3s/server/node-token on your server
$ sudo k3s agent --server https://myserver:6443 --token ${NODE_TOKEN}
$ kubectl version
$ kubectl get componentstatuses
$ kubectl get nodes
$ kubectl describe nodes node-1
$ kubectl -n anothernamespace get pods
$ kubectl --all-namespaces get pods
Cluster o Namespace
$HOME/.kube/config
$ kubectl config set-context my-context --namespace=my-namespace
$ kubectl config use-context my-context
$HOME/.kube/config
. ¡SEA CONSCIENTE DE ELLO!$ kubectl get pods
$ kubectl get pods my-pod -o jsonpath --template={.status.podIP}
$ kubectl describe <resource-name> <obj-name>
$ kubectl apply -f obj.yaml
$ vi obj.yaml # update some resources
$ kubectl apply --dry-run -f obj.yaml # output the changes without making them
$ kubectl apply -f obj.yaml
$ kubectl edit <resource-name> <obj-name> # after saving it is automatically updated
$ kubectl delete -f obj.yaml
$ kubectl delete <resource-name> <obj-name>
$ kubectl top nodes
$ kubectl logs <pod-name>
$ kubectl exec -ti exec <pod-name> -- bash
$ kubectl attach -it <pod-name>
$ kubectl cp <pod-name>:</path/to/remote/file> </path/to/local/file>
$ kubectl port-forward <pod-name> 8080:80
$ kubectl help
$ kubectl help | grep kubeconfig
$ kubectl help | less
CNCF
CDF